package edu.bu.grocerylist.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Object that represents a user's Grocery List for shopping.
 * 
 * @author donlanp
 * 
 */
public class GroceryList  implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3067425426447921093L;
	public final static String NEW_STATUS = "new";
	public final static String IN_PROGRESS_STATUS = "inprogress";
	public final static String FINISHED = "finished";

	private int groceryListId;
	
	private int groceryUserId;

	private String name;
	private String description;

	private Date shoppingDate;

	private String status;
	
	private List<GroceryListItem> shoppingItems;

	/**
	 * Default Constructor
	 */
	public GroceryList() {
		this.status = NEW_STATUS;
		shoppingItems = new ArrayList<GroceryListItem>();
		this.shoppingDate = new Date();
	}

	public GroceryList(String name, String description, Date shoppingDate) {
		super();
		this.name = name;
		this.description = description;
		this.shoppingDate = shoppingDate;
		this.status = NEW_STATUS;
		this.shoppingItems = new ArrayList<GroceryListItem>();
	}

	/**
	 * @return the groceryListId
	 */
	public int getGroceryListId() {
		return groceryListId;
	}

	/**
	 * @param groceryListId
	 *            the groceryListId to set
	 */
	public void setGroceryListId(int groceryListId) {
		this.groceryListId = groceryListId;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description
	 *            the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the shoppingDate
	 */
	public Date getShoppingDate() {
		return shoppingDate;
	}

	/**
	 * @param shoppingDate
	 *            the shoppingDate to set
	 */
	public void setShoppingDate(Date shoppingDate) {
		this.shoppingDate = shoppingDate;
	}

	/**
	 * @return the status
	 */
	public String getStatus() {
		return status;
	}

	/**
	 * @param status
	 *            the status to set
	 */
	public void setStatus(String status) {
		this.status = status;
	}

	/**
	 * @return the groceryUserId
	 */
	public int getGroceryUserId() {
		return groceryUserId;
	}

	/**
	 * @param groceryUserId the groceryUserId to set
	 */
	public void setGroceryUserId(int groceryUserId) {
		this.groceryUserId = groceryUserId;
	}
	
	/**
	 * For the purposes of debugging the domain class
	 */
	public String toString() {
		
		String structure = "GroceryList name: " + this.name + "\n";
		structure += "GroceryList description: " + this.description + "\n";
		structure += "GroceryList Shopping Date: " + this.shoppingDate + "\n";
		structure += "GroceryList ID: " + this.groceryListId + "\n";
		structure += "GroceryUser ID: " + this.groceryUserId + "\n";
		structure += "GroceryList Status: " + this.status + "\n";
		
		return structure;
	}

	/**
	 * @return the shoppingItems
	 */
	public List<GroceryListItem> getShoppingItems() {
		return shoppingItems;
	}

	/**
	 * @param shoppingItems the shoppingItems to set
	 */
	public void setShoppingItems(List<GroceryListItem> shoppingItems) {
		this.shoppingItems = shoppingItems;
	}

}
